package com.kotlin.user.presenter

import com.kotlin.library.ext.execut
import com.kotlin.library.presenter.BasePresenter
import com.kotlin.library.rx.BaseSubscriber
import com.kotlin.user.Service.UserService
import com.kotlin.user.presenter.view.RegisterView
import javax.inject.Inject

/**
 *
 * USER: zjw
 * DATA: 2018/11/27 0027
 * TIME: 下午 4:02
 * 具体的presenter类继承basePresenter,里面处理一些业务逻辑的操作,他也持有具体的VIew的引用
 */
class RegisterPresenter @Inject constructor() : BasePresenter<RegisterView>() {
    @Inject
    lateinit var userService: UserService

    fun register(mobile: String, verifyCode: String, pwd: String) {
        userService.register(mobile, verifyCode, pwd)
            .execut(object : BaseSubscriber<Boolean>() {
                override fun onNext(t: Boolean?) {
                    if (t!!)
                        mView.onRegisterView("注册成功")
                }
            }, lifecycleProvider)

    }
}